﻿using System;
using Web.Core.EventArgs;
using Ayatta.Contract.Domain;
using System.Collections.Specialized;

namespace Web.Core.OAuths
{
    public interface IOAuthClient
    {
        /// <summary>
        /// 用户成功授权后触发事件
        /// </summary>
        event EventHandler<EventArgs<OAuthUser>> Authorized;

        /// <summary>
        /// Returns URI of service which should be called in order to start authentication process. 
        /// You should use this URI when rendering login link.
        /// </summary>
        string GetLoginUri(string state = null);

        /// <summary>
        /// Obtains user information using third-party authentication service 
        /// using data provided via callback request.
        /// </summary>
        /// <param name="param">
        /// Callback request payload (parameters).
        /// <example>Request.QueryString</example>
        /// </param>
        MagicKit<OAuthUser> Callback(NameValueCollection param);
    }
}
